package com.jackstraw.jack_base.mq.rocketmq.bean;

import com.jackstraw.jack_base.mq.common.entity.MQProducer;
import lombok.Data;
import org.apache.rocketmq.common.topic.TopicValidator;

@Data
public class RocketMqProducer extends MQProducer {


    /**
     * 发送消息超时的毫秒。
     * <p>
     * Millis of send message timeout.
     */
    private int sendMessageTimeout = 3000;

    /**
     * 压缩消息体阈值，即默认压缩的消息体大于4k。
     * <p>
     * Compress message body threshold, namely, message body larger than 4k will be compressed on default.
     */
    private int compressMessageBodyThreshold = 1024 * 4;

    /**
     * 在同步模式中声明发送失败之前，在内部执行的最大重试次数。
     * 这可能会潜在地导致消息重复，这取决于应用程序开发人员来解决。
     * <p>
     * Maximum number of retry to perform internally before claiming sending failure in synchronous mode.
     * This may potentially cause message duplication which is up to application developers to resolve.
     */
    private int retryTimesWhenSendFailed = 2;

    /**
     * <p>在异步模式下声明发送失败之前，内部重试的最大次数。< / p >
     * 这可能会潜在地导致消息重复，这取决于应用程序开发人员来解决。
     *
     * <p> Maximum number of retry to perform internally before claiming sending failure in asynchronous mode. </p>
     * This may potentially cause message duplication which is up to application developers to resolve.
     */
    private int retryTimesWhenSendAsyncFailed = 2;

    /**
     * 指示在内部发送失败时是否重试另一个代理。
     * <p>
     * Indicate whether to retry another broker on sending failure internally.
     */
    private boolean retryNextServer = false;

    /**
     * 允许的最大消息大小，以字节为单位。
     * <p>
     * Maximum allowed message size in bytes.
     */
    private int maxMessageSize = 1024 * 1024 * 4;

    /**
     * “access-key”的属性。
     * <p>
     * The property of "access-key".
     */
    private String accessKey;

    /**
     * “secret-key”的属性。
     * <p>
     * The property of "secret-key".
     */
    private String secretKey;

    /**
     * 切换消息跟踪的标志实例。
     * <p>
     * Switch flag instance for message trace.
     */
    private boolean enableMsgTrace = true;

    /**
     * 消息跟踪主题的名称值。 如果不配置，则可以使用默认跟踪主题名称。
     * <p>
     * The name value of message trace topic.If you don't config,you can use the default trace topic name.
     */
    private String customizedTraceTopic = TopicValidator.RMQ_SYS_TRACE_TOPIC;
}
